package com.ruben.state.example;

import java.util.HashMap;
import java.util.Map;

/**
 * 审核应用
 *
 * @author <achao1441470436@gmail.com>
 * @since 2021/10/17 19:15
 */
public class ApprovalApplication {
    public static void main(String[] args) {
        Map<String, Object> param = new HashMap<>(1 << 2);
        System.out.println("用户提交审核");
        WaitStatus waitStatus = new WaitStatus();
        ApprovalExecutor executor = new ApprovalExecutor(waitStatus);
        waitStatus.setExecutor(executor);
        Map<String, Object> result = executor.execute(param);
        System.out.println(result);
        System.out.println("再次尝试提交");
        executor.execute(param);
        System.out.println("用户填写内容");
        param.put(ApprovalStatus.CONTENT, "666");
        System.out.println("用户再次提交审核");
        executor.changeStatus(waitStatus);
        result = executor.execute(param);
        System.out.println(result);
        executor.execute(param);

    }
}
